/***************************************************************************
 * getitems.cpp
 * Copyright (C) 2010  Jared Bell
 *
 * This file is part of FreeESP.
 *
 * FreeESP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * FreeESP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with FreeESP.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Credits:
 * + compudaze <compudaze@gmail.com> - FreeESP author.
 * + SuperNovaAO <itshax.com> - posted his CoD6Wallhack180 source code &
 *   showed me how to access the console.
 * + R3B3L <gamedeception.net forums> - posted how to disable recoil.
 ***************************************************************************/

#include "getitems.h"
#include <boost/assign/list_of.hpp>
#include <boost/assign/std/vector.hpp>

using namespace boost::assign;

/***************************************************************************
 * NoRecoil sigs:
 * + noRecoil: 68 ?? ?? ?? 00 6A 01 E8 ?? ?? ?? ?? 83 C4 08 5E 5B 83 C4 10 C3
 ***************************************************************************/
MemHackItemList GetNoRecoilItems() {
  MemHackItemList il;

  MemHackItem noRecoil(
      0x45F8D3 + 0xD4,
      list_of(0xE8)(0x84)(0xB7)(0xFD)(0xFF),
      nop5);

  il += noRecoil;

  return il;
}

/***************************************************************************
 * Esp sigs:
 * + chopperBox1:       75 ?? 38 05 ?? ?? ?? ?? 74 ?? 56 E8 ?? ?? ?? ?? 83 C4 04 F6 05 ?? ?? ?? ?? 10 74 ?? 56 E8 ?? ?? ?? ?? 83 C4 04
 * + coldBloodedFix:   75 6F 39 87 E0 00 00 00
 * + nameTag1:          0F 85 F9 00 00 00 F7 05 ?? ?? 7F 00 00 18 00 00
 * + drawThroughWalls: 74 06 B0 01 83 C4 5C
 ***************************************************************************/
MemHackItemList GetEspItems() {
  MemHackItemList il;

  MemHackItem chopperBox1(
      0x4B27F0,
      list_of(0x75)(0x23),
      nop2);
  MemHackItem chopperBox2(
      0x4B27F0 + 0x8,
      list_of(0x74)(0x09),
      nop2);
  MemHackItem chopperBox3(
      0x4B27F0 + 0x1A,
      list_of(0x74)(0x09),
      nop2);
  MemHackItem coldBloodedFix(
      0x5A468E,
      list_of(0x75)(0x6F),
      nop2);
  MemHackItem nameTag1(
      0x5883A6,
      list_of(0x0F)(0x85)(0xF9)(0x00)(0x00)(0x00),
      nop6);
  MemHackItem nameTag2(
      0x5883A6 + 0x27,
      list_of(0x0F)(0x84)(0xD2)(0x00)(0x00)(0x00),
      nop6);
  MemHackItem nameTag3(
      0x5883A6 + 0x34,
      list_of(0x0F)(0x84)(0xC5)(0x00)(0x00)(0x00),
      nop6);
  MemHackItem nameTag4(
      0x5883A6 + 0x3C,
      list_of(0x0F)(0x84)(0xBD)(0x00)(0x00)(0x00),
      nop6);
  MemHackItem nameTag5(
      0x5883A6 + 0x3C,
      list_of(0x0F)(0x85)(0xA3)(0x00)(0x00)(0x00),
      nop6);
  MemHackItem drawThroughWalls(
      0x58818C,
      list_of(0x74)(0x06),
      nop2);

  il += chopperBox1, chopperBox2, chopperBox3,
        coldBloodedFix,
        nameTag1, nameTag2, nameTag3, nameTag4, nameTag5,
        drawThroughWalls;

  return il;
}

/***************************************************************************
 * Thermal sigs:
 * + thermal1:        74 ?? B0 01 C3 F7 ?? ?? ?? ?? ??
 * + blackWhiteFix: 0F 84 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 0F B6 49 10
 ***************************************************************************/
MemHackItemList GetThermalItems() {
  MemHackItemList il;

  MemHackItem thermal1(
      0x59F6EB,
      list_of(0x74)(0x03),
      nop2);
  MemHackItem thermal2(
      0x59F6EB + 0x63,
      list_of(0x74),
      jmp);
  MemHackItem blackWhiteFix(
      0x513C61,
      list_of(0x0F)(0x84)(0xBD)(0x00)(0x00)(0x00),
      nop6);

  il += thermal1, thermal2, blackWhiteFix;

  return il;
}